package ForthQuestion;

import java.util.List;

/**
 * @author cyt
 * @date 2020/6/14
 */
public class ModifyStudent {

    public static boolean modifyStudent(List<Student> students, Student student){
        int count = 0;
        for(int i = 0; i <= students.size() - 1; i++){
            if(students.get(i).getStudentNum() == student.getStudentNum()){
                students.get(i).setName(student.getName());
                students.get(i).setAge(student.getAge());
                count++;
            }
        }
        if(count == 0){
            System.out.println("该学生不存在！请先增添这个学生！");
            return false;
        }

        return true;
    }
}
